package com.gxa.service.impl;

import com.github.pagehelper.PageHelper;
import com.gxa.pojo.TenantBill;
import com.gxa.dao.TenantBillMapper;
import com.gxa.service.TenantBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TenantBillServiceImpl implements TenantBillService {

    @Autowired
    private TenantBillMapper tenantBillMapper;

    @Override
    public boolean addTenantBill(TenantBill tenantBill) {
        return tenantBillMapper.insertIenantBill(tenantBill)>0;
    }

    @Override
    public List<TenantBill> showAllTenantBillByPage(int pageNum,int pageSize) {

        PageHelper.startPage(pageNum, pageSize);

        List<TenantBill> tenantBills = tenantBillMapper.selectAllTenantBill();

        return tenantBills;

//        return tenantBillMapper.selectAllTenantBill();
    }

    @Override
    public boolean deleteByBillNumber(String billNumber) {
        return tenantBillMapper.deleteByBillNumber(billNumber)>0;
    }
}
